<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title></title>
  <script src="https://cdn.bootcss.com/react/16.4.0/umd/react.development.js"></script>
  <script src="https://cdn.bootcss.com/react-dom/16.4.0/umd/react-dom.development.js"></script>
  <script src="https://cdn.bootcss.com/babel-standalone/6.26.0/babel.min.js"></script>
</head>

<body>
  <div id="root">

  </div>
</body>

</html>

<script type="text/babel">
  class List extends React.Component {
   constructor(props) {
     super(props);
   }

   render() {
    let heroList = this.props.heroList;
    return (
      <ul>
        {heroList.map(hero =>{
            return (
                <li key={hero.id}>
                  {hero.heroName} -- {hero.role}
                </li>
              )
            }
        )}
      </ul>
    )
   }
}

const heroList = [
  {id: 1, heroName: '亚瑟', role: '战士'},
  {id: 2, heroName: '牛魔王', role: '战士'},
  {id: 3, heroName: '鲁班七号', role: '射手'}
];

ReactDOM.render(
<List heroList={heroList} />,
  document.getElementById('root')
);

</script>